home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1599 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  96 lines

  1. Path: sn.no!not-for-mail
  2. From: christon (Christopher Naas)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: More
  5. Date: 21 Jan 1996 17:29:15 +0100
  6. Organization: SN Internett
  7. Message-ID: <1551.6594T1046T1254@Th0r.foo.bar>
  8. References: <9601201749.AA00046@cliffe.demon.co.uk>
  9. NNTP-Posting-Host: sinsen.sn.no
  10. X-Newsreader: THOR 2.21 (Amiga;SOUP)
  11.  
  12. Steven Chapman wrote:
  13.  
  14. >Thanks for the last lot of help but i am looking for something like this
  15. >but when i try too compile it i get
  16. [..]
  17.  
  18. #include <proto/dos.h>
  19. #include <proto/icon.h>
  20. #include <stdio.h>
  21.  
  22.  
  23. struct DiskObject *kFindDiskObject     (char *);
  24. struct DiskObject *icon = NULL, *toolicon = NULL;
  25.  
  26.  
  27. void __main (char *Line)
  28. {
  29.    UBYTE **tooltypes,
  30.          *textp;
  31.    BPTR   file;
  32.  
  33.    if (icon = kFindDiskObject (Line))
  34.    {
  35.       tooltypes = (char **)icon->do_ToolTypes;
  36.  
  37.       if (file = Open ("T:xx", MODE_READWRITE))
  38.       {
  39.          textp = FindToolType (tooltypes, "PROG");
  40.  
  41.          Execute (textp, 0, file);
  42.  
  43.          Delay (200);
  44.          Close (file);
  45.       }
  46.  
  47.       FreeDiskObject (icon);
  48.    }
  49. }
  50.  
  51.  
  52.  
  53.  
  54. struct DiskObject *kFindDiskObject (char *Line)
  55. {
  56.    struct DiskObject *DiskObj;
  57.    char               NameAndPath[512],
  58.                      *a;
  59.  
  60.  
  61.    if (_WBenchMsg)
  62.    {
  63.       sprintf (NameAndPath, "PROGDIR:%s\0", WBenchMsg->sm_ArgList->wa_Name);
  64.  
  65.       if (DiskObj = GetDiskObject (NameAndPath))
  66.          return DiskObj;
  67.    }
  68.  
  69.    *Line++;
  70.    a = Line;
  71.  
  72.    while (*a!='"')
  73.       *a++;
  74.  
  75.    *a='\0';
  76.  
  77.    sprintf (NameAndPath, "%s", Line);
  78.  
  79.    if (DiskObj = GetDiskObject (NameAndPath))
  80.       return DiskObj;
  81.  
  82.    if (DiskObj = GetDefDiskObject (WBTOOL))
  83.       return DiskObj;
  84.  
  85.    return NULL;
  86. }
  87.  
  88.  
  89. You should replace Execute with dos.library/SystemTagList.
  90.  
  91.  
  92. --
  93. Christopher Landmark Naas    o  EMail: christon@sn.no
  94. LoungeBar Development        o  WWW:   http://www.sn.no/~christon/
  95. Former Reg. Amiga Developer  o  IRC:   KarmaComa
  96.